<script setup lang="ts">
import {ref} from 'vue'
import Login from '@/components/login/loginForm.vue'
import Register from '@/components/login/registerForm.vue'

const onclick = () => {
  vari.value = !vari.value
}
const vari = ref<boolean>(false)
</script>

<template>
  <div :class="{container:true,'sign-up-model': vari}">
    <div class="inner-left-container">
      <div class="login-content">
        <h1 style="color: white">电影购票后台系统</h1>
        <el-button type="primary" @click="onclick">去注册</el-button>
      </div>
      <img src="@/assets/login.svg" class="image"/>
    </div>
    <div class="inner-right-container">
      <div class="register-content">
        <h1 style="color: white">电影购票后台系统</h1>
        <el-button type="primary" @click="onclick">去登录</el-button>
      </div>
      <img src="@/assets/reg.svg" class="image"/>
    </div>
    <div class="inner-sign-up-container">
      <Login :class="{'sign-up-model': vari}"></Login>
      <Register :class="{'sign-up-model': vari}"></Register>
    </div>
  </div>
</template>

<style scoped>
.container {
  width: 100vw;
  height: 100vh;
  background-color: white;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: row;
}

.container:before {
  content: "";
  width: 2000px;
  height: 2000px;
  background-color: rgb(160, 209, 35);
  position: absolute;
  z-index: 2;
  border-radius: 50%;
  transform: translateY(-50%);
  right: 48%;
  top: -10%;
  transition: 1.8s ease-in-out;
}

.inner-left-container {
  width: 0;
  flex: 1;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: flex-end;
  padding: 3rem 10% 2rem 10%;
  pointer-events: all;
}

.inner-right-container {
  width: 0;
  flex: 1;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: flex-start;
  padding: 3rem 10% 2rem 10%;
  pointer-events: none;
}

.container .inner-right-container .register-content,
.container .inner-right-container .image {
  transform: translateX(1000px);
  transition: 1s ease-in-out;
  transition-delay: 0.5s;
}

.container .inner-left-container .login-content,
.container .inner-left-container .image {
  transition: 1s ease-in-out;
  transition-delay: 0.5s;
}

.image {
  width: 100%;
}

.inner-sign-up-container {
  width: 50%;
  height: 50%;
  position: absolute;
  right: 0;
  top: 20%;
  z-index: 1;
  transition: 1s ease-in-out;
  transition-delay: 0.5s;
  display: grid;
  grid-template-columns: 1fr;
}

/* 动画 */
.container.sign-up-model::before {
  transform: translate(100%, -50%);
  transition: 1.8s ease-in-out;
  right: 52%;
}

.container.sign-up-model .inner-right-container .register-content,
.container.sign-up-model .inner-right-container .image {
  transform: translateX(0);
  transition: 1s ease-in-out;
  transition-delay: 0.5s;
}

.container.sign-up-model .inner-left-container .login-content,
.container.sign-up-model .inner-left-container .image {
  transform: translateX(-1000px);
  transition: 1s ease-in-out;
  transition-delay: 0.5s;
}

.container.sign-up-model .inner-sign-up-container {
  width: 50%;
  height: 50%;
  top: 20%;
  right: 50%;
  transition: 1s ease-in-out;
  transition-delay: 0.5s;
}

.container.sign-up-model .inner-right-container {
  pointer-events: all;
}

.container.sign-up-model .inner-left-container {
  pointer-events: none;
}

@media screen and(max-width: 992px) {
  .container {
    flex-direction: column;
  }

  .container::before {
    width: 1500px;
    height: 1500px;
    position: absolute;
    top: inherit;
    bottom: inherit;
    left: inherit;
    right: inherit;
    transform: translate(-30%, -80%);
  }

  .inner-left-container {
    height: 0;
    flex: 1;
    width: 100%;
    flex-direction: row;
    align-items: flex-start;
  }

  .inner-right-container {
    height: 0;
    flex: 1;
    width: 100%;
    flex-direction: row;
    align-items: flex-end;
  }

  .image {
    width: 40%;
  }

  .container .inner-right-container .register-content,
  .container .inner-right-container .image {
    transform: translateY(1000px);
  }

  .container .inner-sign-up-container {
    width: 70%;
    height: 50%;
    left: 15%;
    right: 15%;
    top: 40%;
  }

  /* 动画 */
  .container.sign-up-model .inner-left-container .login-content,
  .container.sign-up-model .inner-left-container .image {
    transform: translateY(-1000px);
    transition: 1s ease-in-out;
  }

  .container.sign-up-model::before {
    width: 1500px;
    height: 1500px;
    position: absolute;
    top: inherit;
    bottom: inherit;
    left: inherit;
    right: inherit;
    transform: translate(-30%, 45%);
  }

  .container.sign-up-model .inner-sign-up-container {
    width: 70%;
    height: 50%;
    left: 15%;
    right: 15%;
    top: 10%;
  }
}

@media screen and (max-width: 570px) {
  .container{
    background-color: rgb(160, 209, 35);
  }
  .container .inner-sign-up-container{
    background-color: white;
    border-radius: 8px;
  }
  .container::before{
    display: none;
  }
}

</style>